<?php
/* @var $this GrainController */
/* @var $model Grain */
/* @var $form CActiveForm */
?>

<div class="wide form" id="form_search">

<?php $form=$this->beginWidget('CActiveForm', array(
        'action'=>Yii::app()->createUrl($this->route),
        'method'=>'get',
        'htmlOptions'=>array('class'=>'form-horizontal','role'=>'form')
)); ?>

        <div class="form-group">
                <?php echo $form->label($model,'nom',array("class"=>"col-lg-2 control-label")); ?>
                <div class="col-lg-10"><?php echo $form->textField($model,'nom',array("class"=>"form-control")); ?></div>
        </div>
        
        <div class="form-group">
                <?php echo $form->label($model,'idtype',array("class"=>"col-lg-2 control-label")); ?>
                <div class="col-lg-10">
                        <?php 
                        $data = CHtml::listData(Type::model()->findAll(array('order'=>'lib asc')),
                                'id', 
                                'lib'
                        );
                        $vide =  array('0'=>'Tous les types');
                        echo $form->dropDownList($model,'idtype',$vide+$data,array("class"=>"form-control"));
                        ?>
                </div>
        </div>
        
        <div class="form-group">
                <?php echo $form->label($model,'iddomaine',array("class"=>"col-lg-2 control-label")); ?>
                <div class="col-lg-10">
                        <?php 
                        $data = CHtml::listData(Domaine::model()->findAll(array('order'=>'lib asc')),
                                'id', 
                                'lib'
                        );
                        $vide =  array('0'=>'Tous les domaines');
                        echo $form->dropDownList($model,'iddomaine',$vide+$data,array("class"=>"form-control"));
                        ?>
                </div>
        </div>
        
        <div class="form-group">
                <?php echo $form->label($model,'idseliste',array("class"=>"col-lg-2 control-label")); ?>
                <div class="col-lg-10">
                        <?php 
                        $data = CHtml::listData(Seliste::model()->findAll(array('order'=>'id asc')),
                                'id', 
                                function($model) {
										$retour = $model->id;
										if (($model->v_pseudo == 1) || ($model->v_nom == 1) || ($model->v_prenom == 1)) $retour .= " (";
										if ($model->v_pseudo == 1) $retour .= $model->pseudo;
										if (($model->v_nom == 1) || ($model->v_prenom == 1)) $retour .= " - ";
										if ($model->v_nom == 1) $retour .= $model->nom . " ";
										if ($model->v_prenom == 1) $retour .= $model->prenom;
										if (($model->v_pseudo == 1) || ($model->v_nom == 1) || ($model->v_prenom == 1)) $retour .= ")";
										return $retour;
                                }
                        );
                        $vide =  array('0'=>'Tous les sélistes');
                        echo $form->dropDownList($model,'idseliste',$vide+$data,array("class"=>"form-control"));
                        ?>
                </div>
        </div>

        <div class="form-group">
                <div class="col-lg-offset-2 col-lg-10">
                        <?php echo CHtml::submitButton('Rechercher',array("class"=>"btn btn-primary")); ?>
                        <?php echo CHtml::button('Réinitialiser',array("class"=>"btn btn-info","id"=>"init-button")); ?>
                </div>
        </div>

<?php $this->endWidget(); ?>

</div><!-- search-form -->